home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 4
/
FM Towns Free Software Collection 4 - Disc 1.iso
/
fb386
/
socio
/
socio.bas
< prev
next >
Wrap
BASIC Source File
|
1991-10-18
|
12KB
|
314 lines
10 ' ############################################################
20 ' # ソシオメトリー #
30 ' # #
40 ' # 開発 MZ-731 昭和58年 #
50 ' # 移植 FM-7 昭和59年(打ち直し) #
60 ' # PC8801mk2SR 昭和61年(RS-232C) #
70 ' # PC9801VM2 昭和62年(コンバータ) #
80 ' # FM-16β 昭和62年(エデイタ) #
90 ' # 修正完了 昭和63年4月 #
100 '# #
110 '# 著作権保持者 後藤勝美 #
120 '# #
130 '############################################################
140 clear:console 0,24,1:defint A-Z:color 7,0:cls
150 J=2:K=5
160 '
170 gosub *INITIALIZE
180 print:input"印刷時のタイトルを入力してください ";TI$
190 input"選択制限数(何名まで選択させるか)は ";D
200 input"調査表を作成しますか(プリンター用意) (Y/N)";S$
210 '----- SCREEN -----
220 cls
230 if S$="Y" or S$="y" then console 0,24,0
240 if M>=(W-M) then L=int(M/2-.5)+5
250 if (W-M)>M then L=int((W-M)/2-.5)+5
260 locate 5,3:print" ****** データを入力してください ******":Y=1
270 if Y=W+1 then Y=1
280 if Y=0 then Y=W
290 locate 0,0:print" ";N$(Y);:color 2
300 print" が好きな者 ":color 7
310 Z=1:goto 360
320 locate 0,0:print" ";N$(Y);:color 1
330 print" が嫌いな者 ":color 7
340 Z=-1
350 '--- NAME ----
360 P=0:Q=5
370 for A=1 to W
380 locate P,Q
390 if Y(Y,A)=1 and Z=1 then color 2
400 if Y(Y,A)=-1 and Z=-1then color 1
410 print using"##";A;
420 color 7,0:print" ";N$(A)
430 if Q=L then P=P+19:Q=5 else Q=Q+1
440 if A=M then P=38:Q=5
450 next
460 beep:if S$="Y" or S$="y" then *TYOUSA
470 'LINE(0,330)-(639,380),PSET,7,B
480 'PAINT(10,370),4,7
490 locate 0,21
500 print" E:終了 M:資料マトリクス G:ソシオグラム S:調査データ登録 *:次(の子)へ"
510 print" Z:前者 N:名簿登録 A:転入者追加 D:転出者抹消 B:データ修正"
520 S$="":goto *SELECT
530 '--- シリョウ マトリクス ----
540 locate 0,19:input"資料マトリクスをプリントしますか(Y/N) ";Y$
550 if Y$="Y" or Y$="y" then 560 else 860
560 locate 0,19:print space$(70)
570 locate 0,19:input"プリンターをセットしましたか (Y/N) ";Y$
580 lprint"< 資料マトリクス > ";TI$
590 L1$=" 11111111112222222222333333333344444444445"
600 L2$=" 12345678901234567890123456789012345678901234567890"
610 M1$=left$(L1$,W+12)
620 M2$=left$(L2$,W+12)
630 lprint
640 lprint M1$
650 lprint M2$;
660 lprint" C R CRS mc mr Isss"
670 for Q=1 to W
680 lprint using"##";Q;:lprint using"& &";N$(Q);
690 for P=1 to W
700 if Y(P,Q)=1 and Y(Q,P)=1 then lprint"L";:C=C+1:MC=MC+1:goto 750
710 if Y(P,Q)=1 then lprint"o";:C=C+1:goto 750
720 if Y(P,Q)=-1 and Y(Q,P)=-1 then lprint"H";:R=R+1:MR=MR+1:goto 750
730 if Y(P,Q)=-1 then lprint"x";:R=R+1:goto 750
740 lprint"・";
750 next P
760 lprint using" ## ## #### ## ## ####.##";C;R;C-R;MC;MR;((C-R)/(W-1)+(MC-MR)/D)/2*1000
770 C(Q)=C:R(Q)=R:CRS(Q)=C(Q)-R(Q)
780 C=0:R=0:CRS=0:MC=0:MR=0
790 next Q
800 lprint:lprint
810 lprint"o:選択 x:排除 L:相互選択 H:相互排除"
820 lprint"C:選択数 R:排除数 C-R:差引 mc:相互選択数 mr:相互排除数"
830 lprint"Isss(x1000):地位指数"
840 lprint:lprint"COMPLEET !":beep
850 A=1:Y$="":return 210
860 locate 0,19:print space$(40):return 1110
870 '--- 構造マトリクス -----
880 '
890 '
900 '
910 '
920 '
930 '
940 '----- SELECTION --------------------------
950 *SELECT
960 locate 0,19:print space$(70)
970 locate 0,19:input"御命令を";MEI$
980 if MEI$="B" or MEI$="b" then gosub 2140
990 if MEI$="M" or MEI$="m" then gosub 540
1000 if MEI$="G" or MEI$="g" then gosub 1280
1010 if MEI$="S" or MEI$="s" then gosub 2840
1020 if MEI$="*" or MEI$="*" then goto 1240
1030 if MEI$="Z" or MEI$="z" then gosub 1260
1040 'IF MEI$="K" THEN GOSUB 900
1050 if MEI$="A" or MEI$="a" then gosub 1680
1060 if MEI$="D" or MEI$="d" then gosub 1940
1070 if MEI$="I" or MEI$="i" then gosub 3060
1080 if MEI$="E" or MEI$="e" then goto *END
1090 if MEI$="N" or MEI$="n" then gosub 2600
1100 locate 0,19:print" "
1110 G=val(MEI$):MEI$=""
1120 if G<=0 then G=0:MEI$="":goto *SELECT
1130 if G<=(L-4) then locate 0,G+4:goto 1180
1140 if G<=M then locate 19,G-L+8:goto 1180
1150 if G<=(M+L-4) then locate 38,G-M+4:goto 1180
1160 if G>W then goto *SELECT
1170 locate 57,G-M-L+8:goto 1180
1180 if G=Y then G=0:MEI$="":goto *SELECT
1190 if Z=1 then color 2:print using"##";G:Y(Y,G)=1
1200 if Z=-1 then color 1:print using"##";G:Y(Y,G)=-1
1210 G=0
1220 locate 0,19:print" "
1230 color 7:goto *SELECT
1240 if Z=1 then 320
1250 if Z=-1 then Y=Y+1:goto 270
1260 Y=Y-1:goto 270
1270 '----- ソシオグラム -----
1280 locate 0,19:input"ソシオグラムを表示しますか (Y/N) ";Y$
1290 if Y$="Y" or Y$="y" then 1300 else 1560
1300 locate 0,19:print space$(70)
1310 locate 0,19:print"選択、排除を実線で結びます。 "
1320 beep:for I=1 to 5000:next
1330 console 0,24,0:cls:gosub 1590
1340 for P=1 to W:for Q=1 to W
1350 if Y(P,Q)<>1 or Q<P then 1410
1360 X1=210*cos(3.14159/180*O*P)+330:Y1=190-160*sin(3.14159/180*O*P)
1370 X2=210*cos(3.14159/180*O*Q)+330:Y2=190-160*sin(3.14159/180*O*Q)
1380 line(X1,Y1)-((X1+X2)/2,(Y1+Y2)/2),pset,7,,&HFFFF
1390 if Y(Q,P)=1 then line((X1+X2)/2,(Y1+Y2)/2)-(X2,Y2),pset,7,,&HFFFF:goto 1410
1400 line((X1+X2)/2,(Y1+Y2)/2)-(X2,Y2),pset,7,,&H6666
1410 next Q,P
1420 locate 0,0:input"印刷しますか(Y/N) ";Y$
1430 if Y$="Y" or Y$="y" then locate 0,0:print space$(70) else 1440
1435 locate 0,0:print"< 選択 > ";TI$:hardc 4 else 1440
1440 cls:gosub 1590
1450 color 7
1460 for P=1 to W:for Q=1 to W
1470 if Y(P,Q)<>-1 or Q<P then 1530
1480 X1=210*cos(3.14159/180*O*P)+330:Y1=190-160*sin(3.14159/180*O*P)
1490 X2=210*cos(3.14159/180*O*Q)+330:Y2=190-160*sin(3.14159/180*O*Q)
1500 line(X1,Y1)-((X1+X2)/2,(Y1+Y2)/2),pset,7,,&HFFFF
1510 if Y(Q,P)=-1 then line((X1+X2)/2,(Y1+Y2)/2)-(X2,Y2),pset,7,,&HFFFF:goto 1530
1520 line((X1+X2)/2,(Y1+Y2)/2)-(X2,Y2),pset,7,,&H6666
1530 next Q,P
1540 locate 0,0:input"印刷しますか (Y/N) ";Y$
1550 if Y$="Y" or Y$="y" then locate 0,0:print space$(70) else 1560
1555 LOCATE0,0:print"< 排除 > ";TI$:hardc 4 else 1560
1560 beep
1570 Y$="":Y=1:cls 3:console 0,24,1:return 220
1580 '----- RING -----
1590 color 1:O=340/W:P=1:Q=1:CO=1
1600 for A=1 to W
1610 X1=int(240*cos(3.14159/180*O*A)+320)
1620 Y1=int(180-176*sin(3.14159/180*O*A))
1630 symbol@(X1,Y1),N$(A),1,1,CO,0,or
1640 if A=M then CO=2
1650 next A
1660 return
1670 '----- ADD NAME ----
1680 if W>47 then 950
1690 locate 0,19:input"転入者追加。追加する個人名は";H$
1700 if H$="" then 1920
1710 locate 0,19:print space$(70)
1720 locate 0,19:input"何番の後に挿入しますか";I$
1730 I=val(I$)
1740 if I>W then H$="":I$="":goto 1920
1750 for A=W+1 to I+2 step -1
1760 N$(A)=N$(A-1)
1770 next A
1780 for P=W+1 to I+2 step -1
1790 for Q=W+1 to I step -1
1800 Y(P,Q)=Y(P-1,Q)
1810 next Q,P
1820 for Q=W+1 to I+2 step -1
1830 for P=W+1 to 1 step -1
1840 Y(P,Q)=Y(P,Q-1)
1850 next P,Q
1860 for A=1 to W+1
1870 Y(I+1,A)=0:Y(A,I+1)=0
1880 next A
1890 if I=<M then M=M+1
1900 W=W+1
1910 N$(I+1)=H$:H$="":I$=""
1920 locate 0,19:print space$(70):return 210
1930 '----- ERASE -----
1940 locate 0,19:input"転出者削除。何番を削除しますか";E$
1950 if E$="" then 2120
1960 E=val(E$)
1970 for A=E to W-1
1980 N$(A)=N$(A+1)
1990 next A
2000 N$(W+1)=""
2010 for P=E to W-1:for Q=1 to W-1
2020 Y(P,Q)=Y(P+1,Q)
2030 next Q,P
2040 for Q=E to W-1:for P=1 to W-1
2050 Y(P,Q)=Y(P,Q+1)
2060 next P,Q
2070 for A=1 to W+1
2080 Y(A,W)=0:Y(W,A)=0
2090 next A
2100 if E=<M then M=M-1
2110 W=W-1:E$=""
2120 locate 0,19:print space$(70):return 210
2130 '----- DEBUG -----
2140 locate 0,19
2150 input"データ修正。何番ですか。";T$
2160 if T$="" then 2260
2170 N=val(T$)
2180 if N<1 or N>W then T$="":goto 2260
2190 Y(Y,N)=0
2200 if N<=(L-4) then locate 0,N+4:goto 2250
2210 if N<=M then locate 19,N-L+8:goto 2250
2220 if N<=(M+L-4) then locate 38,N-M+4:goto 2250
2230 if N>W then goto 2260
2240 locate 57,N-M-L+8
2250 print using"##";N:T$="":N=0
2260 locate 0,19:print space$(70)
2270 return
2280 '----- 初期設定 -----
2290 *INITIALIZE
2300 color 5:line(0,0)-(639,100),pset,,b,&H8888:print
2310 print" ソシオメトリー"
2320 print:print" 製作 後藤勝美"
2330 print:print
2340 print:print:color 7
2350 input"クラスの人数は ";W
2360 input"男子の人数は ";M
2370 dim Y(50,50),M$(48),N$(48),C(48),R(48),CRS(48)
2380 line(0,0)-(639,100),preset,,b:print:print"1:名簿を読み込む "
2390 print"2:これから入力する "
2400 color 2:input"どちらですか?番号を入力して下さい。";C$:color 7
2410 if C$="1" then 2700
2420 if C$="2" then 2430 else 2400
2430 beep:color 2:print:print"名前を出席番号順に入力して下さい。漢字なら1人3文字以内にすると見易いです。"
2440 color 5:print:print"〈 * を入力すると1つ前に戻ります 〉":color 7,0
2450 for A=1 to W
2460 print using"##";A;
2470 input M$(A)
2480 if M$(A)="*" then A=A-2 else 2510
2490 if A=-1 then 2450
2500 if A=0 then 2450 else 2520
2510 N$(A)=left$(M$(A),10)
2520 next
2530 print:input"登録しますか(Y/N)";B$
2540 if B$="Y" or B$="y" then 2550 else return
2550 input"ファイル名は";F$
2560 open F$ for output as #1
2570 for A=1 to W:print #1,N$(A):next A
2580 close:beep:print"終りました":return
2590 '----- SAVE NAME DATA -----
2600 locate 0,19:input"名前を登録しますか(Y/N) ";Y$
2610 if Y$="Y" or Y$="y" then 2620 else 2670
2620 locate 0,19:print space$(70)
2630 locate 0,19:input"ファイル名は";F$
2640 open F$ for output as #1
2650 for A=1 to W:print #1,N$(A):next
2660 close:beep
2670 locate 0,19:print space$(70)
2680 Y$="":return
2690 '----- LOAD DATA -----
2700 files:color 2:print"これがドライブ0のファイル一覧表です。この中から選んで下さい。":color 7
2710 input"ファイル名は";F$
2720 open F$ for input as #1
2730 for A=1 to W:input #1,N$(A):next
2740 close:beep:print
2750 input"データを読み込みますか(Y/N)";D$
2760 if D$="Y" or D$="y" then 2770 else return
2770 input"ファイル名は";F$
2780 open F$ for input as #1
2790 for X=1 to W:for Y=1 to W
2800 input #1,Y(X,Y)
2810 next Y,X
2820 close:D$="":beep:cls:return
2830 '----- SAVE DATA -----
2840 locate 0,19
2850 input"データを登録しますか(Y/N) ";Y$
2860 if Y$="Y" or Y$="y" then 2870 else 2940
2870 locate 0,19:print space$(70)
2880 locate 0,19:input"ファイル名は ";F$
2890 open F$ for output as #1
2900 for X=1 to W:for Y=1 to W
2910 print #1,Y(X,Y)
2920 next Y,X
2930 close:D$="":beep:return
2940 locate 0,19:print space$(70)
2950 Y$="":return
2960 '----- 調査表 ----------------
2970 *TYOUSA
2980 locate 0,0:print"友だちしらべ ( 番 氏名 )"
2990 print:print"おなじはんになりたい人・・・・・・・○(";D;"人まで) "
3000 print"おなじはんになりたくない人・・・×(";D;"人まで) "
3010 print" "
3020 locate 0,18:print"*他の人のを見ないで、だまって書きなさい。"
3030 print"*あてはまる人がいなければ、書かなくてよい。"
3040 print"*出席番号順に提出しなさい。"
3050 hardc 4:S$="":console 0,24,1:goto 220
3060 '----- PROGRUM END -------------
3070 *END
3080 locate 0,19:input"プログラムを終わりますか (Y/N)";Y$
3090 if Y$="Y" or Y$="y" then 3100 else 3110
3100 cls:new
3110 locate 0,19:print space$(79):goto *SELECT